<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>
  <xsl:param name="CSSClass">sitemap</xsl:param>
  <xsl:template match="/*">
    <xsl:apply-templates select="root" />
  </xsl:template>
  <xsl:template match="root">
    <!-- init menu -->
    <script type="text/javascript">
      var indexMenu = 0;
      <xsl:apply-templates select="node" mode="initMenuLevel" />
      ddtabmenu.definemenu("ddtabs3", indexMenu);
    </script>

    <!-- navigation -->
    <div style="color: #B2B2B2" class="solidblockmenu" id="ddtabs3">
      <xsl:apply-templates select="node" mode="topLevel" />
    </div>
    <div class="tabcontainer">
      <xsl:apply-templates select="node" mode="subLevel" />
    </div>
  </xsl:template>


  <xsl:template match="node" mode="topLevel">
    <li>
      <xsl:choose>
        <xsl:when test="@enabled = 1">
          <a href="{@url}" rel="sb{@id}">
            <xsl:attribute name="class">
              <xsl:choose>
                <xsl:when test="@breadcrumb = 1">
                  current
                </xsl:when>
                <xsl:otherwise>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:attribute>
            <b>
              <xsl:value-of select="@text" />
            </b>
          </a>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@text" />
        </xsl:otherwise>
      </xsl:choose>
    </li>

  </xsl:template>

  <xsl:template match="node" mode="subLevel">
    <div class="tabcontent" id="sb{@id}" style="display: none;">
      <ul style="float: left;" class="home">
        <xsl:if test="node">
          <xsl:apply-templates select="node" />
        </xsl:if>
      </ul>
    </div>
  </xsl:template>


  <xsl:template match="node">
    <li>
      <xsl:choose>
        <xsl:when test="@enabled = 1">
          <a href="{@url}">
            <xsl:value-of select="@text" />
          </a>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="@text" />
        </xsl:otherwise>
      </xsl:choose>
    </li>
  </xsl:template>

  <xsl:template match="node" mode="initMenuLevel">
    <xsl:choose>
      <xsl:when test="@breadcrumb = 1">
        indexMenu = <xsl:value-of select="position()" /> - 1;
      </xsl:when>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>